package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println("hello world")
	fmt.Println("菜鸟")
	fmt.Println("hahah" + "wojoiji")

	// %d 表示整型数字，%s 表示字符串
	var stockCode = 123
	var enddate = "2020-12-31"
	var url = "Code=%d&endDate=%s"
	// 格式化字符串
	var target_url = fmt.Sprintf(url, stockCode, enddate)
	fmt.Println(target_url)

	var stack []byte
	//stack := []byte{}
	stack = append(stack, 'a', 'b', 'c')
	fmt.Println(stack) //[97 98 99]

	var stack2 []byte
	for i, ch := range enddate {
		fmt.Println(i, ch)
		stack2 = append(stack2, byte(ch))
	}
	fmt.Println(stack2) //[50 48 50 48 45 49 50 45 51 49]

	/*
		0 50
		1 48
		2 50
		3 48
		4 45
		5 49
		6 50
		7 45
		8 51
		9 49
	*/

	strTest := "sdclone sdclone   sdclone"
	strTest = strings.ReplaceAll(strTest, " ", "%20")
	fmt.Println(strTest)

}
